{extend name="public/base" /}

{block name="title"}<title>请假审核</title>{/block}

{block name="pjax_container"}
<style>
    .btn-primary {
        background-color: #1890FF;
    }
</style>
<section class="content-header">
    <h4>请假审核</h4>
    <ol class="breadcrumb">
        <li class="active"><i class="fa fa-dashboard"></i> 请假审核</li>
    </ol>
</section>
<section class="content">
    <div class="row">
        <div class="col-md-12">
            <div class="box box-primary">
                {include file="form_search/search_leave" /}
                <div class="box-header with-border">
                    <div class="pull-left">
                        {:authAction(CONTROLLER_NAME.'/leave','create16')}
                    </div>
                </div>
                <div class="box-body table-responsive">
                    <table class="table table-bordered table-hover">
                        <tr>
                            <th>工号</th>
                            <th>姓名</th>
                            <th>请假类型</th>
                            <th>请假天数</th>
                            <th>申请理由</th>
                            <th>初审人</th>
                            <th>终审人</th>
                            <th>状态</th>
                            <th>操作</th>
                        </tr>
                        {volist name="$list" id="v"}
                        <tr>
                            <td>{$v["job_number"]}</td>
                            <td>{$v["b_name"]}</td>
                            <td>
                                {if condition="$v.type eq 1"}
                                事假
                                {elseif condition="$v.type eq 2"}
                                病假
                                {elseif condition="$v.type eq 3"}
                                其他
                                {/if}
                            </td>
                            <td>{$v["day"]}</td>
                            <td>{$v["reason"]}</td>
                            <td>{$v["c_name"]}</td>
                            <td>{$v["d_name"]}</td>
                            <td>
                                {if condition="$v.status eq 0"}
                                待初审
                                {elseif condition="$v.status eq 1"}
                                待终审
                                {elseif condition="$v.status eq 2"}
                                审核通过
                                {elseif condition="$v.status eq 3"}
                                驳回
                                {/if}
                            </td>
                            <td>
                                {if condition="$v.status eq 0 && $v.first_check_user_id==$user_id"}
                                {:authAction(CONTROLLER_NAME.'/leave_check_edit','edit8',['id'=>$v['id']])}
                                {/if}
                                {if condition="$v.status eq 1 && $v.last_check_user_id==$user_id"}
                                {:authAction(CONTROLLER_NAME.'/leave_check_edit','edit8',['id'=>$v['id']])}
                                {/if}
                                {:authAction(CONTROLLER_NAME.'/leave_info','edit2',['id'=>$v['id']])}
                            </td>
                        </tr>
                        {/volist}
                    </table>
                </div>
                <div class="box-footer clearfix">
                    {$list->render()}
                </div>
            </div>
        </div>
    </div>
</section>
<script>
    $(function(){
        // 列表部分 全选
        $('input[type="checkbox"].minimal, input[type="radio"].minimal').iCheck({
            checkboxClass: 'icheckbox_minimal-blue',
            radioClass: 'iradio_minimal-blue'
        });
        $('.checkbox-toggle').on('ifChecked', function(event){
            var _this = $(this);
            var _table = _this.closest('.table');
            _table.find("tr td input[type='checkbox']").iCheck("check");
        });
        $('.checkbox-toggle').on('ifUnchecked', function(event){
            var _this = $(this);
            var _table = _this.closest('.table');
            _table.find("tr td input[type='checkbox']").iCheck("uncheck");
        });
    });
</script>
{/block}
